<template>
  <div class="login-wraaper">
    <div class="container">
       <el-tabs v-model="showTag">
        <el-tab-pane label="登录" name="login">
          <Login></Login>
        </el-tab-pane>
        <el-tab-pane label="注册" name="register">
          <register @show-login="showLogin"></register>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, toRefs } from 'vue'
import Register from './components/register'
import Login from './components/login'

interface LoginState{
  showTag: 'login' | 'register';
}

export default defineComponent({
  components: {
    Register,
    Login
  },
  setup () {
    const state = reactive<LoginState>({
      showTag: 'login'
    })

    const showLogin = () => {
      state.showTag = 'login'
    }

    return {
      ...toRefs(state),
      showLogin
    }
  }
})
</script>

<style lang="scss" scoped>
.login-wraaper{
  display: flex;
  align-items: center;
  justify-content: center;
  .container{
    margin-top: 100px;
    background: #ffffff;
    width: 700px;
    padding: 20px;
  }
}
</style>
